/********************************************************************
FileName    :   Bll_yw_dcdB.cs
CreateTime  :   2015-09-18 12:09
BaseClass   :   Bll_yw_dcdB
FileType    :   .cs
Author      :  minjie
Description :   Bll_yw_dcdBBLL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.Common;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_yw_dcdB的摘要说明。
	/// </summary>
public partial class   Bll_yw_dcdB 
  	{ 
     		      
  		private readonly Dal_yw_dcdB dal=new  Dal_yw_dcdB(); 
  		public  Bll_yw_dcdB() 
  		{} 
  		 
  		#region  Method 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public bool  Add(yw_dcdB_Entity model) 
  		{ 
  			return dal.Add(model); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(yw_dcdB_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(yw_dcdB_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(int  DjBth) 
  		{ 
  			 
  			return dal.Delete(DjBth); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string DjBthlist ) 
  		{ 
  			return dal.DeleteList(DjBthlist ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public yw_dcdB_Entity GetModel(int  DjBth) 
  		{ 
  			 
  			return dal.GetModel(DjBth); 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			return dal.GetList(Top,strWhere,filedOrder); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_dcdB_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_dcdB_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<yw_dcdB_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<yw_dcdB_Entity> modelList = new List<yw_dcdB_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				yw_dcdB_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  					model = new yw_dcdB_Entity();					 
  				if(dt.Rows[n]["DjLsh"]!=null&&dt.Rows[n]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[n]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[n]["DjBth"]!=null&&dt.Rows[n]["DjBth"].ToString()!="") 
  				{ 
  					model.DjBth=int.Parse(dt.Rows[n]["DjBth"].ToString()); 
  				} 
  				model.DjState= dt.Rows[n]["DjState"].ToString(); 
  				if(dt.Rows[n]["hh"]!=null&&dt.Rows[n]["hh"].ToString()!="") 
  				{ 
  					model.hh=int.Parse(dt.Rows[n]["hh"].ToString()); 
  				} 
  				model.spbh= dt.Rows[n]["spbh"].ToString(); 
  				model.sptm= dt.Rows[n]["sptm"].ToString(); 
  				model.cjhh= dt.Rows[n]["cjhh"].ToString(); 
  				model.spmc= dt.Rows[n]["spmc"].ToString(); 
  				model.dw= dt.Rows[n]["dw"].ToString(); 
  				model.ys= dt.Rows[n]["ys"].ToString(); 
  				model.flh= dt.Rows[n]["flh"].ToString(); 
  				model.flmc= dt.Rows[n]["flmc"].ToString(); 
  				model.xlbh= dt.Rows[n]["xlbh"].ToString(); 
  				model.xlmc= dt.Rows[n]["xlmc"].ToString(); 
  				if(dt.Rows[n]["sl"]!=null&&dt.Rows[n]["sl"].ToString()!="") 
  				{ 
  					model.sl=decimal.Parse(dt.Rows[n]["sl"].ToString()); 
  				} 
  				if(dt.Rows[n]["jj"]!=null&&dt.Rows[n]["jj"].ToString()!="") 
  				{ 
  					model.jj=decimal.Parse(dt.Rows[n]["jj"].ToString()); 
  				} 
  				if(dt.Rows[n]["jjje"]!=null&&dt.Rows[n]["jjje"].ToString()!="") 
  				{ 
  					model.jjje=decimal.Parse(dt.Rows[n]["jjje"].ToString()); 
  				} 
  				if(dt.Rows[n]["lsj"]!=null&&dt.Rows[n]["lsj"].ToString()!="") 
  				{ 
  					model.lsj=decimal.Parse(dt.Rows[n]["lsj"].ToString()); 
  				} 
  				if(dt.Rows[n]["lsje"]!=null&&dt.Rows[n]["lsje"].ToString()!="") 
  				{ 
  					model.lsje=decimal.Parse(dt.Rows[n]["lsje"].ToString()); 
  				} 
  				if(dt.Rows[n]["drkcsl"]!=null&&dt.Rows[n]["drkcsl"].ToString()!="") 
  				{ 
  					model.drkcsl=decimal.Parse(dt.Rows[n]["drkcsl"].ToString()); 
  				} 
  				if(dt.Rows[n]["dckcsl"]!=null&&dt.Rows[n]["dckcsl"].ToString()!="") 
  				{ 
  					model.dckcsl=decimal.Parse(dt.Rows[n]["dckcsl"].ToString()); 
  				} 
  				model.hbz= dt.Rows[n]["hbz"].ToString(); 
  				model.gysbh= dt.Rows[n]["gysbh"].ToString(); 
  				 
  					modelList.Add(model); 
  				} 
  			} 
  		} 
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
